﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace Lian.yiban
{
    /// <summary>
    /// 视频上传处理程序
    /// </summary>
    public class VideoUploadHandler : IHttpHandler
    {
        /// <summary>
        /// 处理请求
        /// </summary>
        /// <param name="context"></param>
        public void ProcessRequest(HttpContext context)
        {
            // 读取参数 解码 UrlEncode编码
            string fileName = HttpUtility.UrlDecode(context.Request.QueryString["filename"]);
            ////标题
            //string headline = HttpUtility.UrlDecode(context.Request.QueryString["headline"]);
            //if (string.IsNullOrWhiteSpace(headline))
            //{
            //    headline = "短视频";
            //}
            //地理位置 
            //string location = HttpUtility.UrlDecode(context.Request.QueryString["location"]);
            // 读取用户Id
            //TBUsers user = IdentityManager.ReadUser();
            //int userId = user.Id;
            //// 媒体处理
            //IVideoManager videoManager = new VideoManager();
            //OperResult<CreateUploadVideoResult> createResult = videoManager.ToBeUpload(userId, fileName, headline, location);
            //// 输出
            //string jsonString = JsonConvert.SerializeObject(createResult.ReadResult());
            context.Response.ContentType = "text/plain";
            //context.Response.Write(jsonString);
            context.Response.End();
        }

        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}